import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)


const routes = [
  {
    path:"/",
    redirect:"/Home"
  },
  {
    path:"/Home",
    name:"Home",
    component:()=>import(/*webpackChunkName:"home" */'../views/Home/Home.vue'),
    meta: {
      isShowNav: true
    }
  },
  {
    path:"/Cart",
    name:"Cart",
    component:()=>import(/*webpackChunkName:"Cart" */'../views/Cart/Cart.vue'),
    meta: {
      isShowNav: true,
      title:"购物车"
    }
  },
  {
    path:"/Login",
    name:"Login",
    component:()=>import(/*webpackChunkName:"Login" */'../views/Login/Login.vue'),
    meta: {
      isShowNav: false
    }
  },
  {
    path:"/User",
    name:"User",
    component:()=>import(/*webpackChunkName:"User" */'../views/User/User.vue'),
    meta: {
      isShowNav: true,
      title:"个人中心"
    }
  },
  {
    path:"/Categary",
    name:"Categary",
    component:()=>import(/*webpackChunkName:"Categary" */'../views/Categary/Categary.vue'),
    meta: {
      isShowNav: true
    }
  },
  {
    path:"/Info/:productID",
    name:"Info",
    component:()=>import(/*webpackChunkName:"Info" */'../views/Info/Info.vue'),
    meta: {
      isShowNav: false,
      title:"商品详情"
    }
  },
  {
    path:"/addressList",
    name:"addressList",
    component:()=>import(/*webpackChunkName:"addressList" */'../views/addressList/addressList.vue'),
    meta: {
      isShowNav: false,
      title:"地址管理"
    },
  },
  {
    path:"/addressAdd",
    name:"addressAdd",
    component:()=>import(/*webpackChunkName:"addressList" */'../views/addressList/addressListAdd.vue'),
    meta: {
      isShowNav: false,
      title:"新增地址"
    }
  },
  {
    path:"/createOrder",
    name:"createOrder",
    component:()=>import(/*webpackChunkName:"createOrder" */'../views/createOrder/createOrder.vue'),
    meta: {
      isShowNav: false,
      title:"确认订单"
    }
  },
  {
    path:"/order",
    name:"order",
    component:()=>import(/*webpackChunkName:"Order" */'../views/Order/Order.vue'),
    meta: {
      isShowNav: false,
      title:"我的订单"
    }
  },
  {
    path:"/itemOrder",
    name:"itemOrder",
    component:()=>import(/*webpackChunkName:"itemOrder" */'../views/Order/itemOrder.vue'),
    meta: {
      isShowNav: false,
      title:"订单详情"
    }
  },
  {
    path:"/userNum",
    name:"userLoginNum",
    component:()=>import(/*webpackChunkName:"userLoginNum" */'../views/User/userLoginNum.vue'),
    meta: {
      isShowNav: false,
    }
  },
  {
    path:"/categaryItemList",
    name:"categaryItemList",
    component:()=>import(/*webpackChunkName:"categaryItemList" */'../views/Categary/categaryItemList.vue'),
    meta: {
      isShowNav: false,
    }
  },

]
const router = new VueRouter({
  routes,
  mode:"hash"
})
// router.beforeEach((to,from,next)=>{
// if (to.path!="/Login") {
//   if (localStorage.getItem("xftoken")) {
//     next()
//   }else{
//     next("/Login")
//   }
// }
// if (to.path=="/createOrder") {
//   if (from.path=="/order"){
//     next("/Home")
//   }else{
//     next()
//   }
// }
// })
export default router
